<?xml version="1.0" encoding="utf-8"?>
<openerp>
	<data>
		
		<report 
            id="account.account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
            file="account.report_invoice"
            attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            groups="applico_v8.hidden_applico"
        />
		
		<record id="invoice_tree_applico" model="ir.ui.view">
			<field name="name">account.invoice.tree.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account.invoice_tree"/>
			<field name="arch" type="xml">
				<field name="number" position="replace">
					<field name="number" invisible="1"/>
					<field name="internal_number"/>
				</field>
			</field>
		</record>

		<record id="view_account_invoice_filter_applico" model="ir.ui.view">
			<field name="name">account.invoice.select.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account.view_account_invoice_filter"/>
			<field name="arch" type="xml">
				<field name="number" position="replace">
					<field name="number" string="Invoice" filter_domain="['|','|','|','|', ('internal_number','ilike',self), ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'child_of', self)]"/>
				</field>
			</field>
		</record>

		<record id="invoice_form_cancel_inherit_applico" model="ir.ui.view">
			<field name="name">invoice.form.cancel.inherit.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account_cancel.invoice_form_cancel_inherit"/>
			<field name="arch" type="xml">
				<button name="invoice_cancel" position="replace">
					<button name="invoice_cancel" states="proforma2,sale,open" string="Cancel Invoice" groups="account.group_account_invoice"/>
				</button>
			</field>
		</record>

		<record id="invoice_supplier_cancel_form_inherit_applico" model="ir.ui.view">
			<field name="name">invoice.supplier.cancel.form.inherit.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account_cancel.invoice_supplier_cancel_form_inherit"/>
			<field name="arch" type="xml">
				<button name="invoice_cancel" position="replace">
					<button name="invoice_cancel" states="proforma2,sale,open" string="Cancel Invoice" groups="account.group_account_invoice"/>
				</button>
			</field>
		</record>


		<record id="invoice_supplier_form_applico" model="ir.ui.view">
			<field name="name">account.invoice.supplier.form.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account.invoice_supplier_form"/>
			<field name="arch" type="xml">
				<field name='number' position="replace">
					<field name="number" class="oe_inline" invisible="1"/>
					<field name="internal_number" class="oe_inline"  attrs="{'invisible': [('state', '=', 'draft')]}"/>
				</field>
				<field name="partner_bank_id" position="replace">
					<field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)" invisible="1"/>
				</field>
				<button name="action_cancel_draft" position="replace">
					<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" invisible="1"/>
				</button>
				<field	name="currency_id" position="after">
					<field name="cur_rate" groups="base.group_multi_currency"/>
				</field>
				<field	name="payment_term" position="after">
					<field name="change_rate" groups="base.group_multi_currency"/>
				</field>
			</field>
		</record>

		<record id="invoice_form_applico" model="ir.ui.view">
			<field name="name">account.invoice.form.applico</field>
			<field name="model">account.invoice</field>
			<field name="inherit_id" ref="account.invoice_form"/>
			<field name="arch" type="xml">
				<button name="%(account.action_account_invoice_refund)d" position="replace">
					<button name="%(account.action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="account.group_account_manager"/>
				</button>
				<field name='number' position="replace">
					<field name="number" class="oe_inline" invisible="1"/>
					<field name="internal_number" class="oe_inline"  attrs="{'invisible': [('state', '=', 'draft')]}"/>
				</field>
				<field name="partner_bank_id" position="replace">
					<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id" invisible="1"/>
				</field>
				<button name="action_invoice_sent" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" position="replace">
					<button name="action_invoice_sent" type="object" string="Send by Email" invisible="1" class="oe_highlight" groups="base.group_user"/>
				</button>
				<button name="action_invoice_sent" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}" position="replace">
					<button name="action_invoice_sent" type="object" string="Send by Email" invisible="1" groups="base.group_user"/>
				</button>
				<button name="action_cancel_draft" position="replace">
					<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" invisible="1"/>
				</button>
				<field name="currency_id" position="after">
					<field name="cur_rate" groups="base.group_multi_currency"/>
				</field>
				<field	name="date_due" position="after">
					<field name="change_rate" groups="base.group_multi_currency"/>
				</field>
			</field>
 		</record>
	</data>
</openerp>
